/**
 * Created by siqing on 2017/5/8.
 */
var webApp = angular.module('webView',['ui.router']);


$(document).ready(
    function(){
        // 下拉菜单
        $('.dropdown-toggle').dropdown();
    }
);

webApp.config(function($stateProvider,$urlRouterProvider){
 /*   $urlRouterProvider.otherwise('index_content');
*/
    $urlRouterProvider.when('','_index_')
    $stateProvider
        .state("content",{
        url:'/',
        views:{
            '':{
                templateUrl:'htmlPage/total/content.html'
            },
            'header@content':{
                templateUrl:'htmlPage/header/index_header.html'
            },
            'footer@content':{
                templateUrl:"htmlPage/footer/footer.html"
            }
        }
    })
        .state('content._index_',{
            url:'_index_',
            views: {
                'body@content': {
                    templateUrl: "htmlPage/Body/_index_.html"
                }
            }
        })
        .state('content._index_.tab1',{
            url:'/tab1',
            views:{
                'chart':{
                    templateUrl:"htmlPage/Body/chartTab/tab1.html"
                }
            }

        })
        .state('content._index_.tab2',{
            url:'/tab2',
            views:{
                'chart':{
                    templateUrl:"htmlPage/Body/chartTab/tab2.html"
                }
            }

        })
    
});

webApp.controller('chart',['$scope',function($scope){
    //图表js
    var ctx = $("#myChart").get(0).getContext("2d");
    var myNewChart = new Chart(ctx).Line(data,defaults,{responsive:true});

}]);

webApp.controller('_swiper',['$scope',function($scope){
    // 轮播图
    var mySwiper = new Swiper('.swiper-container',{
        width:window.innerWidth,
        height:window.innerHeight,
        // autoplay:3000,
        preventClicks : false,
        garbCursor:true,
        loop: true,
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        pagination : '.swiper-pagination',
        paginationClickable :true,

    });
    $scope.move_=function(){
        $('#btn1').click(function(){
            $('#move_litter').css('left','20px');
        });

        $('#btn2').click(function(){
            $('#move_litter').css('left','88px');
        });
        $('#btn3').click(function(){
            $('#move_litter').css('left','168px');
        });
        $('#btn4').click(function(){
            $('#move_litter').css('left','242px');
        })
    }
}]);

webApp.controller('_swiper-2',['$scope',function(){
    var mySwiper = new Swiper('.swiper-container-2',{
        width:window.innerWidth,
        height:window.innerHeight,
        autoplay:4000,
        preventClicks : false,
        garbCursor:true,
        loop: true,
        pagination : '.swiper-pagination',
        paginationClickable :true,
        centeredSlides : true,
    });
}])

/*全局变量图表数据*/
var data = {
    labels : ["1月","2月","3月","4月","5月","6月","7月"],
    datasets : [
        {
            fillColor : "rgba(220,220,220,0.5)",
            strokeColor : "#ff0800",
            pointColor : "#ffe714",
            pointStrokeColor : "#ffe714",
            data : [30,55,68,56,80,70,90]
        },
        {
            fillColor : "rgba(151,187,205,0.5)",
            strokeColor : "rgba(151,187,205,1)",
            pointColor : "rgba(151,187,205,1)",
            pointStrokeColor : "#fff",
            data : [28,48,40,19,96,27,100]
        }
    ]
};
var defaults={
    scaleFontSize : 20,
    datasetFill : true,
    bezierCurve : false,
    scaleShowLabels : true,
    scaleLabel : "<%=value%>",
    scaleFontColor : "#000",     //文字颜色
    animation : true,            // 是否执行动画
    animationSteps : 500,          // 动画的时间
    animationEasing : "easeOutQuart"    // 动画的特效
};


function video_show_1(){
    $('#video_1').addClass('video_showout');
    $('#video_2').removeClass('video_showout');
    $('#video_3').removeClass('video_showout');
    $('.mark').addClass('video_showout');
}
function video_show_2(){
    $('#video_2').addClass('video_showout');
    $('#video_1').removeClass('video_showout');
    $('#video_3').removeClass('video_showout');
    $('.mark').addClass('video_showout');
}
function video_show_3(){
    $('#video_3').addClass('video_showout');
    $('#video_2').removeClass('video_showout');
    $('#video_1').removeClass('video_showout');
    $('.mark').addClass('video_showout');
}
function video_close(){
    $('.video_show').removeClass('video_showout');
    $('.mark').removeClass('video_showout');
}
function hoverPic_1(){
    $('#hoverPic_js_1').css('top','-16px');
}
function downPic_1(){
    $('#hoverPic_js_1').css('top','0');
}
function hoverPic_2(){
    $('#hoverPic_js_2').css('top','-16px');
}
function downPic_2(){
    $('#hoverPic_js_2').css('top','0');
}
function hoverPic_3(){
    $('#hoverPic_js_3').css('top','-16px');
}
function downPic_3(){
    $('#hoverPic_js_3').css('top','0');
}
function hoverPic_4(){
    $('#hoverPic_js_4').css('top','-16px');
}
function downPic_4(){
    $('#hoverPic_js_4').css('top','0');
}